﻿<Window x:Class="SmallTfs.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:config="clr-namespace:SmallTfs"
        Title="MainWindow" Height="639" 
        Background="Transparent" Width="966" mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:my="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client" 
        Loaded="Window_Loaded">

    <Grid Margin="5,5,5,5">
        <Grid.RowDefinitions>
            <RowDefinition Height="23" />
            <RowDefinition Height="23" />
            <RowDefinition Height="25" />
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Row="0" Height="21" VerticalAlignment="Top" >
            <TextBlock Text="ServerName:" VerticalAlignment="Center" Foreground="{StaticResource ButtonNormalBackground}" />
            <TextBox Name="txtServerUrl"  Margin="5,0,0,0"  Text="{Binding ServerName, Mode=TwoWay}" Width="200"   Height="23"  VerticalAlignment="Center"/>
            <TextBlock Text="ProjectName:" Margin="10,0,0,0" VerticalAlignment="Center" Foreground="{StaticResource ButtonNormalBackground}" />
            <TextBox Name="txtProjectName"  Margin="5,0,0,0" Text="{Binding ProjectName, Mode=TwoWay}" Width="100" Height="23"  VerticalAlignment="Center"/>
        </StackPanel>

        <StackPanel Orientation="Horizontal" Grid.Row="1" Height="21" VerticalAlignment="Top" >
            <TextBlock Text="WorkspaceName:" Margin="5,0,0,0"  VerticalAlignment="Center" Foreground="{StaticResource ButtonNormalBackground}" />
            <TextBox Name="txtWorkSpaceName" Margin="5,0,0,0"  Text="{Binding WorkspaceName, Mode=TwoWay}" Width="150"   Height="23"  VerticalAlignment="Center"/>
            <TextBlock Text="Local path:"  Margin="5,0,0,0" VerticalAlignment="Center" Foreground="{StaticResource ButtonNormalBackground}" />
            <TextBox Name="txtMapProjectPath" Margin="5,0,0,0" Text="{Binding LocalPath, Mode=TwoWay}" Width="200" />
            <TextBlock Text="Root marge source"  Margin="5,0,0,0" VerticalAlignment="Center" Foreground="{StaticResource ButtonNormalBackground}" />
            <TextBlock Margin="5,0,0,0" Text="{Binding RootMergePath}" VerticalAlignment="Center" Width="200" Foreground="{StaticResource ButtonNormalBackground}"/>
            <Label Content="" Height="18" HorizontalContentAlignment="Right" Name="lblTaskCount" Width="70" />
        </StackPanel>
        <Button Name="bntConnect" Content="Connect" Height="23" Width="50" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="2" Click="bntConnect_Click" />
        <TextBlock Name="txtStatus" Text="enter server url" Height="30" VerticalAlignment="Top" Grid.Row="4" />
        <Grid Grid.Row="3" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250" />
                <ColumnDefinition Width="3" />
                <ColumnDefinition Width="*" />

            </Grid.ColumnDefinitions>
            <TreeView Name="tFolders" BorderThickness="0" Grid.Row="0" SelectedItemChanged="tFolders_SelectedItemChanged" >
                <TreeView.ContextMenu>
                    <ContextMenu >
                        <MenuItem Header="Get associated tasks" Click="MenuItem_Click"/>
                        <MenuItem Header="Set branching root" Click="MenuItem_Click_1"/>
                    </ContextMenu>
                </TreeView.ContextMenu>
            </TreeView>
            <GridSplitter Grid.Column="1"  Name="gridSplitter1" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" />
            <GridSplitter Grid.Column="3"  Name="gridSplitter2" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" />
            <TabControl  Grid.Column="2">
                <TabItem Header="Source code">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <DataGrid Name="grdPendingChanges" AutoGenerateColumns="False" Grid.Row="1" Background="{StaticResource NormalBorderBrush}" RowBackground="{StaticResource ButtonNormalBackground}">
                            <DataGrid.Columns>
                                <DataGridTextColumn  Binding="{Binding FileName}" Header="Filename" Width="auto"/>
                                <DataGridTextColumn  Binding="{Binding LocalOrServerFolder}" Header="Folder" Width="auto"/>
                                <DataGridTextColumn  Binding="{Binding ChangeTypeName}" Header="Type" Width="auto"/>
                                <DataGridTemplateColumn>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnCheckIn" Click="btnCheckIn_Click" Content="CheckIn"  Margin="2" Height="23" Width="100"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                        <DataGrid  AutoGenerateColumns="False" EnableRowVirtualization="True" Grid.Row="0" Name="lstFiles" RowDetailsVisibilityMode="VisibleWhenSelected"  Background="{StaticResource NormalBorderBrush}" RowBackground="{StaticResource SelectedBackgroundBrush}">
                            <DataGrid.Columns>
                                <DataGridTemplateColumn>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Image x:Name="ImgCheckOut" Source="/SmallTfs;component/Images/1301300293_desktop.png" Width="16" Height="16" Stretch="UniformToFill"  Visibility="{Binding Path=IsNotCheckedOut, Mode=OneWay}"/>
                                                <Image x:Name="ImgCheckIn" Source="/SmallTfs;component/Images/1301300283_button_ok.png" Width="16" Height="16" Stretch="UniformToFill"  Visibility="{Binding Path=IsCheckedOut, Mode=OneWay}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTextColumn x:Name="itemIdColumn" Binding="{Binding Path=ServerItem, Mode=OneWay}" Header="Item" IsReadOnly="True"  Width="auto" />
                                <DataGridTextColumn x:Name="itemIdColumn1" Binding="{Binding Path=CheckinDate, Mode=OneWay}" Header="CheckIn Date" IsReadOnly="True" Width="auto" />
                                <DataGridTextColumn x:Name="itemIdColumn2" Binding="{Binding Path=CheckOutOwner, Mode=OneWay}" Header="Owner" IsReadOnly="True" Width="auto"  />
                                <DataGridTextColumn x:Name="itemIdColumn3" Binding="{Binding Path=CheckOutComputer, Mode=OneWay}" Header="Computer" IsReadOnly="True" Width="auto"  />
                                <DataGridTemplateColumn>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnGetLatest"  Click="btnGetLatest_Click" Content="Get latest version" Visibility="{Binding Path=IsCheckedOut, Mode=OneWay}" Margin="2" Height="23" Width="100"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Name="btnCheckout" Click="btnCheckout_Click" Content="CheckOut" Visibility="{Binding Path=IsCheckedOut, Mode=OneWay}" Margin="2" Height="23" Width="100"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </Grid>
                </TabItem>
                <TabItem Header="Branches">
                    <ScrollViewer >
                        <Canvas Name="cnBranches">
                            <TextBlock Text="Not implemented jet" FontSize="25" Canvas.Top="10" Canvas.Left="10"/>
                        </Canvas>
                    </ScrollViewer>
                </TabItem>
                <TabItem Header="Changeset list" Name="TabChangeset">

                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <StackPanel Grid.Row="0">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5" Height="25">
                             <CheckBox Name="chkViewChangesets" Content="View Changesets " VerticalAlignment="Center" Click="chkViewChangesets_Click"/>
                            <Button Content="Refresh labels" Width="100" Click="Button_Click" />
                            </StackPanel>
                        </StackPanel>
                        <TreeView Grid.Row="1" Name="treeLabels" SelectedItemChanged="treeLabels_SelectedItemChanged">
                            <TreeView.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <CheckBox Name="chkSelected" Content="ola"/>
                                    </StackPanel>
                                </DataTemplate>
                            </TreeView.ItemTemplate>

                        </TreeView>



                    </Grid>
                </TabItem>


                <TabItem Header="History" Name="tabHIstory">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition Height="448" />
                        </Grid.RowDefinitions>
                        <Button Content="Load history" Grid.Row="0" Click="Button_Click_1" />
                        <Canvas Name="mainHistory" Grid.Row="10" >
                            <!--<Line Canvas.Top="10" Canvas.Left="10" X1="10" Fill="Yellow"  X2="10" Y1="10"  Y2="50" Stroke="Yellow" />-->
                        </Canvas>
                    </Grid>
                    
                </TabItem>

                <TabItem Header="TaskList" Name="tabTaskList">
                       <config:TaskGrid x:Name="grdTaskList" />
                </TabItem>
            </TabControl>

        </Grid>
        <Button Content="Acumulate tasks for export" Height="23" Name="button1" Margin="706,2,0,0" Grid.Row="2" Click="button1_Click_1" />
    </Grid>
</Window>
